<?php

use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;

Route::group(function () {

    //海报
    Route::group('system/poster', function () {
        Route::get('lst', '/lst')->name('systemPosterLst')->option([
            '_alias' => '列表',
        ]);
        Route::get('create/form', '/createForm')->name('systemPosterForm')->option([
            '_alias' => '添加表单',
            '_auth' => false,
            '_form' => 'systemPosterCreate',
        ]);
        Route::post('create', '/create')->name('systemPosterCreate')->option([
            '_alias' => '添加',
        ]);
        Route::get('update/form/:id', '/updateForm')->name('systemPosterUpdateForm')->option([
            '_alias' => '编辑表单',
            '_auth' => false,
            '_form' => 'systemPosterUpdate',
        ]);
        Route::post('update/:id', '/update')->name('systemPosterUpdate')->option([
            '_alias' => '编辑',
        ]);
        Route::delete('delete/:id', '/delete')->name('systemPosterDelete')->option([
            '_alias' => '删除',
        ]);
    })->prefix('admin.system.poster.Poster')->option([
        '_path' => '/cms/article',
        '_auth' => true,
        '_append'=> [
            [
                '_name'  =>'uploadImage',
                '_path'  =>'/cms/article',
                '_alias' => '上传图片',
                '_auth'  => true,
            ],
            [
                '_name'  =>'systemAttachmentLst',
                '_path'  =>'/cms/article',
                '_alias' => '素材列表',
                '_auth'  => true,
            ],
        ]
    ]);

})->middleware(AllowOriginMiddleware::class)
    ->middleware(AdminTokenMiddleware::class, true)
    ->middleware(AdminAuthMiddleware::class)
    ->middleware(LogMiddleware::class);
